<div class="am-u-sm-12 widget main-w">
	<ol class="am-breadcrumb">
		<li><a href="{:url('/admin/index')}">首页</a></li>
		<li><a href="{:url('index')}">调度中心</a></li>
		<li class="am-active">查看订单</li>
	</ol>
	<div class="am-u-sm-12">
		<form class="am-form-inline tpl-form-border-form" method="get" action="">
			<div class="am-form-group am-u-sm-2 ">
				<div class="am-u-sm-12 cl-p">
					<input type="text" class="am-form-field" name="order_no" placeholder="请输入订单号" value="{$Think.get.order_no}">
				</div>
			</div>
			{if $order_types}
			<div class="am-form-group am-u-sm-2 ">
				<div class="am-u-sm-12 cl-p">
					<select name="order_type" style="height: 33px;" value="{$Think.get.order_type}">
						{order_types}
					</select>
				</div>
			</div>
			{else/}
			{/if}
			<div class="am-form-group am-u-sm-2 ">
				<div class="am-u-sm-12 cl-p">
					<div class="am-u-sm-12 cl-p">
						<input type="hidden" class="car_use_id" name="car_use_id" value="{$Think.get.car_use_id}" />
						<input type="text" class="am-form-field car_use"  data-check='require' name="car_use_name" data-msg="公司/单位不能为空" value="{$Think.get.car_use_name}" placeholder="点击选择公司/单位" readonly="">
					</div>
				</div>

			</div>
			<div class="am-form-group am-u-sm-3">
				<div class="am-u-sm-3 cl-p">
					<select class="orderertype" style="height: 33px;">
						<option value="1">用车人</option>
						<option value="2">预定人</option>
					</select>
				</div>
				<div class="am-u-sm-9 cl-p">
					<div class="am-u-sm-6 cl-p">
						<input type="text" class="am-form-field passenger" name="passenger_name" placeholder="请输入名称" value="{$Think.get.passenger_name}">
						<!--<input type="hidden" name="passenger_name" class="tpl-form-no-bg orderer" placeholder="请输入名称">-->
					</div>
					<div class="am-u-sm-6 cl-p">
						<input type="number" name="passenger_phone" class="am-form-field" placeholder="手机号" value="{$Think.get.passenger_phone}"/>
					</div>
				</div>
			</div>

			<div class="am-form-group am-u-sm-3">
				<button type="submit" class="am-btn am-btn-sm am-btn-primary am-radius" style="margin-top: -2px;">查询<i class="am-icon-search"></i></button>
				<button type="button" id="more" class="am-btn am-btn-sm am-btn-secondary am-radius" style="margin-top: -2px;">更多查询条件</button>
			</div>
			<div id="showmore" style="display: none;">
				<div class="am-u-sm-12" style="padding:5px 0;">
					<div class="am-u-sm-2 ">
						<div class="am-u-sm-12 cl-p">
							<div class="am-u-sm-6 cl-p">
								<div class="am-u-sm-11 cl-p">
									<input type="text" class="am-form-field tpl-form-no-bg arrive_time" name="order_start" placeholder="用车日期起始" data-am-datepicker="" readonly="">
								</div>
								<div class="am-u-sm-1 cl-p" style="text-align: center;">-</div>
							</div>
							<div class="am-u-sm-6 cl-p">
								<div class="am-u-sm-12 cl-p">
									<input type="text" class="am-form-field tpl-form-no-bg complete_time" name="order_end" placeholder="用车日期结束" data-am-datepicker="" readonly="">
								</div>
							</div>
						</div>
					</div>
					<!--<div class="am-u-sm-3 cl-p">
						<label class="am-u-sm-4 am-form-label am-text-truncate ">申请时间:</label>
						<div class="am-u-sm-8 cl-p">
							<div class="am-u-sm-6 cl-p">
								<div class="am-u-sm-11 cl-p">
									<input type="text" class="am-form-field tpl-form-no-bg apply_time" name="apply_start" placeholder="申请日期起始" data-am-datepicker="" readonly="">
								</div>
								<div class="am-u-sm-1 cl-p" style="text-align: center;">-</div>
							</div>
							<div class="am-u-sm-6 cl-p">
								<div class="am-u-sm-12 cl-p">
									<input type="text" class="am-form-field tpl-form-no-bg approval_time" name="apply_end" placeholder="申请日期结束" data-am-datepicker="" readonly="">
								</div>
							</div>
							
						</div>
					</div>-->
					<div class="am-u-sm-6 cl-p">&nbsp;</div>
				</div>
			</div>
		</form>
	</div>
	<div class="am-u-sm-12" style="padding:20px 0 0 20px;">

		<div class="am-tabs">
			<div class="amnav">
				<ul class="am-tabs-nav am-nav am-nav-tabs">
					{if input('param.order_state')}
					<li class={:input( 'param.order_state')==0? 'am-active': " "}>
						<a href="{:url('index',['order_state'=>0])}">全部</a>
					</li>
					{else/}
					<li class='am-active'>
						<a href="{:url('index',['order_state'=>0])}">全部</a>
					</li>
					{/if}
					<li class={:input( 'param.order_state')==1? 'am-active': " "}>
						<a href="{:url('index',['order_state'=>1])}">待审核</a>
					</li>
					<li class={:input( 'param.order_state')==3? 'am-active': " "}>
						<a href="{:url('index',['order_state'=>3])}">已拒绝</a>
					</li>
					<li class={:input( 'param.order_state')==4? 'am-active': " "}>
						<a href="{:url('index',['order_state'=>4])}">待用车</a>
					</li>
					<li class={:input( 'param.order_state')==5? 'am-active': " "}>
						<a href="{:url('index',['order_state'=>5])}">已派车</a>
					</li>
					<li class={:input( 'param.order_state')==6? 'am-active': " "}>
						<a href="{:url('index',['order_state'=>6])}">接驾中</a>
					</li>
					<li class={:input( 'param.order_state')==7? 'am-active': " "}>
						<a href="{:url('index',['order_state'=>7])}">已到达出发地</a>
					</li>
					<li class={:input( 'param.order_state')==8? 'am-active': " "}>
						<a href="{:url('index',['order_state'=>8])}">已到达目的地</a>
					</li>
					<li class={:input( 'param.order_state')==9? 'am-active': " "}>
						<a href="{:url('index',['order_state'=>9])}">待支付</a>
					</li>
					<li class={:input( 'param.order_state')==10? 'am-active': " "}>
						<a href="{:url('index',['order_state'=>10])}">待评价</a>
					</li>
					<li class={:input( 'param.order_state')==11? 'am-active': " "}>
						<a href="{:url('index',['order_state'=>11])}">已完成</a>
					</li>
					<li class={:input( 'param.order_state')==12? 'am-active': " "}>
						<a href="{:url('index',['order_state'=>12])}">已取消</a>
					</li>
					<li class={:input( 'param.order_state')==13? 'am-active': " "}>
						<a href="{:url('index',['order_state'=>13])}">已终止</a>
					</li>
				</ul>
			</div>
			<div class="am-tabs-bd" style="border: 0 ;width: 100%;">
				<div>
					<!--待审核   已拒绝-->
					{if input('param.order_state')==1||input('param.order_state')==3}
					<div><button style="float: right;" type="button" class="am-btn am-btn-default am-radius am-btn-xs" style="margin-top: -2px;">导出文件</button></div>
					<table class="am-table am-table-compact am-table-bordered am-table-radius am-table-striped tpl-table-black am-text-nowrap" style="transition: height 2s;">
						<thead>
							<tr>
								<th>订单号</th>
								<th>申请时间</th>
								<th>开始时间</th>
								<th>订单类型</th>
								<th>申请人</th>
								<th>审核人</th>
								<th>出发地</th>
								<th>目的地</th>
								<th>用车类型</th>
								<th>用车说明</th>
								<th>订单状态</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							{foreach $list as $key => $item}
							<tr data-id='{$item.order_id}'>
								<td>
									<a href="{:url('detail',['order_id'=>$item.order_id])}">{$item.order_no}</a>
								</td>
								<td>{$item.apply_time}</td>
								<td>{$item.order_time}</td>
								<td>{if $item.order_type==1} 公务订单 {elseif $item.order_type==2/} 企业订单 {elseif $item.order_type==3/} 个人订单 {/if}
								</td>
								<td>{$item.orderer}</td>
								<td>{$item.approval}</td>
								<td style="max-width: 180px;overflow: auto;">{$item.departure}</td>
								<td style="max-width: 180px;overflow: auto;">{$item.destination}</td>
								<td>{if $item.use_type==1} 行政执法 {elseif $item.use_type==2/} 特殊公务 {elseif $item.use_type==3/} 重要会议 {elseif $item.use_type==4/} 机要通讯 {elseif $item.use_type==5/} 视察调研 {else/} 公务接待 {/if}
								</td>
								<td>{$item.use_explain}</td>
								<td>
									{if $item.order_state==1} 待审批 {elseif $item.order_state==2/} 已批准 {elseif $item.order_state==3/} 已拒绝 {elseif $item.order_state==4/} 待用车 {elseif $item.order_state==5/} 已派车 {elseif $item.order_state==6/} 接驾中 {elseif $item.order_state==7/} 已到达出发地 {elseif $item.order_state==8/} 已到达目的地 {elseif $item.order_state==9/} 待支付 {elseif $item.order_state==10/} 待评价 {elseif $item.order_state==11/} 已完成 {elseif $item.order_state==12/} 已取消 {elseif $item.order_state==13/} 已终止 {else/} 无效 {/if}
								</td>
								<td>
									<div class="tpl-table-black-operation">
										{if $item.order_state==1}
										<a href="javascript:;" class="consent" data-method="consent">
											<i class="am-icon-pencil"></i> 同意
										</a>
										<a href="javascript:;" class="tpl-table-black-operation-del repulse" data-method="repulse">
											<i class="am-icon-pencil"></i> 拒绝
										</a>
										{if $item.order_state>8}{else/}
												<a href="javascript:;" class="tpl-table-black-operation-del cancel" data-method="cancel">
													<i class="am-icon-pencil"></i> 取消
												</a>
												{/if} 
										{elseif $item.order_state==2||$item.order_state==3/}
										{if $item.order_state>8}{else/}
												<a href="javascript:;" class="tpl-table-black-operation-del cancel" data-method="cancel">
													<i class="am-icon-pencil"></i> 取消
												</a>
												{/if} 
										{elseif $item.order_state==4/}
										<a href="{:url('dispatch',['order_id'=>$item.order_id])}">
											<i class="am-icon-pencil"></i> 派车
										</a>
										{if $item.order_state>8}{else/}
												<a href="javascript:;" class="tpl-table-black-operation-del cancel" data-method="cancel">
													<i class="am-icon-pencil"></i> 取消
												</a>
												{/if} 
										{else/}
										{if $item.order_state>=8}
										<a class="showmap" data-method="showmap" href="javascript:;">
											<i class="am-icon-map"></i> 轨迹
										</a>
										{/if}
										{if $item.order_state>8}{else/}
												<a href="javascript:;" class="tpl-table-black-operation-del cancel" data-method="cancel">
													<i class="am-icon-pencil"></i> 取消
												</a>
										{/if} 
										{/if}
									</div>
								</td>
							</tr>
							{/foreach}

						</tbody>
					</table>
					<div class="am-u-lg-12 am-cf">

						<div class="am-fr">
							{$pager}
						</div>
					</div>
					<!--全部  代用车-->
					{elseif input('param.order_state')==0||input('param.order_state')==4||!input('param.order_state')/}
					<div>
						<div style="padding: 10px;" class="am-u-sm-12">
							<div><button style="float: right;" type="button" class="am-btn am-btn-default am-radius am-btn-xs" style="margin-top: -2px;">导出文件</button></div>
							<table width="100%" class="am-table am-table-compact am-table-bordered am-table-radius am-table-striped tpl-table-black am-text-nowrap">
								<thead>
									<tr>
										<th>订单号</th>
										<th>申请时间</th>
										<th>开始时间(不选择默认即时)</th>
										<th>车辆类型</th>
										<!--<th>订单类型</th>-->
										<th>订单类别</th>
										<th>乘客</th>
										<th>出发地</th>
										<th>目的地</th>
										<th>状态</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									{foreach $list as $key => $item}
									<tr data-id='{$item.order_id}'>
										<td>
											<a href="{:url('detail',['order_id'=>$item.order_id])}">{$item.order_no}</a>
										</td>
										<td>{$item.order_time}</td>
										<td>{$item.orders_time}</td>
										<td>{$item.car_type_name}</td>
										<td>{$item.order_type==1?'公务订单':'个人订单'}</td>
										<!--<td>{$item.order_type}</td>-->
										<td><a href="{:url('/admin/passenger/detail',['passenger_id'=>$item.passenger_id])}">{$item.passenger_name}</a></td>
										<td style="max-width: 180px;overflow: auto;">{$item.departure}</td>
										<td style="max-width: 180px;overflow: auto;">{$item.destination}</td>
										<td>
											{if $item.order_state==1} 待审批 {elseif $item.order_state==2/} 已批准 {elseif $item.order_state==3/} 已拒绝 {elseif $item.order_state==4/} 待用车 {elseif $item.order_state==5/} 已派车 {elseif $item.order_state==6/} 接驾中 {elseif $item.order_state==7/} 已到达出发地 {elseif $item.order_state==8/} 已到达目的地 {elseif $item.order_state==9/} 待支付 {elseif $item.order_state==10/} 待评价 {elseif $item.order_state==11/} 已完成 {elseif $item.order_state==12/} 已取消 {elseif $item.order_state==13/} 已终止 {else/} 无效 {/if}
										</td>
										<td>
											<div class="tpl-table-black-operation">
												{if $item.order_state==1}
												<a href="javascript:;" class="consent" data-method="consent">
													<i class="am-icon-pencil"></i> 同意
												</a>
												<a href="javascript:;" class="tpl-table-black-operation-del repulse" data-method="repulse">
													<i class="am-icon-pencil"></i> 拒绝
												</a>
												{if $item.order_state>=8}{else/}
												<a href="javascript:;" class="tpl-table-black-operation-del cancel" data-method="cancel">
													<i class="am-icon-pencil"></i> 取消
												</a>
												{/if} 
												{elseif $item.order_state==2||$item.order_state==3/}
												<a href="javascript:;" class="tpl-table-black-operation-del cancel" data-method="cancel">
													<i class="am-icon-pencil"></i> 取消
												</a>
												{elseif $item.order_state==4/}
												<a href="{:url('dispatch',['order_id'=>$item.order_id])}">
													<i class="am-icon-pencil"></i> 派车{$item.order_id}
												</a>
												<a href="javascript:;" class="tpl-table-black-operation-del cancel" data-method="cancel">
													<i class="am-icon-pencil"></i> 取消
												</a>
												{else/}
												{if $item.order_state>=8}
												<a class="showmap" data-method="showmap" href="javascript:;">
													<i class="am-icon-map"></i> 轨迹
												</a>
												{/if} 
												{if $item.order_state>8}{else/}
												<a href="javascript:;" class="tpl-table-black-operation-del cancel" data-method="cancel">
													<i class="am-icon-pencil"></i> 取消
												</a>
												{/if} 
												{/if}
											</div>
										</td>
									</tr>
									{/foreach}

								</tbody>
							</table>
							<div class="am-u-lg-12 am-cf">
								<div class="am-fr">
									{$pager}
								</div>
							</div>
						</div>
					</div>
					<!--已派车 接驾中-->
					{elseif input('param.order_state')==5||input('param.order_state')==6/}
					<div>
						<div style="padding: 10px;" class="am-u-sm-12">
							<div><button style="float: right;" type="button" class="am-btn am-btn-default am-radius am-btn-xs" style="margin-top: -2px;">导出文件</button></div>
							<table width="100%" class="am-table am-table-compact am-table-bordered am-table-radius am-table-striped tpl-table-black am-text-nowrap">
								<thead>
									<tr>
										<th>订单号</th>
										<th>计划出发时间</th>
										<th>到达出发地时间</th>
										<th>实际出发时间</th>
										<th>订单类型</th>
										<th>乘客</th>
										<th>司机</th>
										<th>出发地</th>
										<th>目的地</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									{foreach $list as $key => $item}
									<tr data-id='{$item.order_id}'>
										<td>
											<a href="{:url('detail',['order_id'=>$item.order_id])}">{$item.order_no}</a>
										</td>
										<td>{$item.appointment_time}</td>
										<td>{$item.arrive_time}</td>
										<td>{$item.ride_time}</td>
										<td>{$item.order_type==1?'公务订单':'个人订单'}
										</td>
										<td><a href="{:url('/admin/passenger/detail',['passenger_id'=>$item.passenger_id])}">{$item.passenger_name}</a></td>
										<td><a href="{:url('/admin/driver/detail',['driver_id'=>$item.driver_id])}">{$item.driver_name}</a></td>
										<td style="max-width: 180px;overflow: auto;">{$item.departure}</td>
										<td style="max-width: 180px;overflow: auto;">{$item.destination}</td>
										<td>
											<div class="tpl-table-black-operation">
												{if $item.order_state>=8}
												<a class="showmap" data-method="showmap" href="javascript:;">
													<i class="am-icon-map"></i> 轨迹
												</a>
												{/if} 
												{if $item.order_state>8}{else/}
												<a href="javascript:;" class="tpl-table-black-operation-del cancel" data-method="cancel">
													<i class="am-icon-pencil"></i> 取消
												</a>
												{/if} 
											</div>
										</td>
									</tr>
									{/foreach}
								</tbody>
							</table>
							<div class="am-u-lg-12 am-cf">

								<div class="am-fr">
									{$pager}
								</div>
							</div>
						</div>

					</div>
					{else/}
					<!--其他状态-->
					<div>
						<div style="padding: 10px;" class="am-u-sm-12">
							<div><button style="float: right;" type="button" class="am-btn am-btn-default am-radius am-btn-xs" style="margin-top: -2px;">导出文件</button></div>
							<table width="100%" class="am-table am-table-compact am-table-bordered am-table-radius am-table-striped tpl-table-black am-text-nowrap">
								<thead>
									<tr>
										<th>订单号</th>
										<th>计划出发时间</th>
										<th>到达出发地时间</th>
										<th>实际出发时间</th>
										<th>实际到达时间</th>
										<th>订单类型</th>
										<th>乘客</th>
										<th>司机</th>
										<th>里程</th>
										<th>耗时</th>
										<th>费用</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									{foreach $list as $key => $item}
									<tr  data-id='{$item.order_id}'>
										<td>
											<a href="{:url('detail',['order_id'=>$item.order_id])}">{$item.order_no}</a>
										</td>
										<td>{$item.ride_time}</td>
										<td>{$item.arrive_time}</td>
										<td>{$item.ride_time}</td>
										<td>{$item.arrive_time}</td>
										<td>{$item.order_type==1?'公务订单':'个人订单'}</td>
										<td><a href="{:url('/admin/passenger/detail',['passenger_id'=>$item.passenger_id])}">{$item.passenger_name}</a></td>
										<td><a href="{:url('/admin/driver/detail',['driver_id'=>$item.driver_id])}">{$item.driver_name}</a></td>
										<td>{$item.meter}</td>
										<td>{if intval($item.time/3600)==0}{else/}{:intval($item.time/3600)}小时{/if}{:intval(($item.time-intval($item.time/3600)*3600)/60)}分钟</td>
										<td>{$item.order_money}</td>
										<td>
											<div class="tpl-table-black-operation">
												{if $item.order_state>=8}
												<a class="showmap" data-method="showmap" href="javascript:;">
													<i class="am-icon-map"></i> 轨迹
												</a>
												{/if} 
												{if $item.order_state>8}{else/}
												<a href="javascript:;" class="tpl-table-black-operation-del cancel" data-method="cancel">
													<i class="am-icon-pencil"></i> 取消
												</a>
												{/if} 
											</div>
										</td>
									</tr>
									{/foreach}

								</tbody>
							</table>
							<div class="am-u-lg-12 am-cf">

								<div class="am-fr">
									{$pager}
								</div>
							</div>
						</div>

					</div>
					{/if}
				</div>
			</div>
		</div>
	</div>
	
</div>
<script>
	var url = '{url("api/driver.test/index)}';
</script>
<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.2&key={:config('base.mapkey')}&plugin=AMap.Driving"></script>
<script src="//webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>